Repository navigation
fix(loop): reset a unit left in_progress by a killed run instead of halting - #3606
Merged
Merged
Conversation
…alting Closes #3602. A unit is `in_progress` only while a driver runs it; a driver killed mid-attempt never moves it to an outcome, so the next `specfuse run` found it neither dispatchable nor finished and halted the gate with "never became ready", asking the operator to edit its frontmatter by hand. `run()` now holds the working tree's `.specfuse/.loop.lock` before it loads the gate's units, so no other driver in this tree can be running such a unit. On a real (non-dry) run, `reset_interrupted_units` returns each `in_progress` unit to `pending` with `attempts: 0`, the reset is committed as bookkeeping (so a later failed attempt's `git reset --hard` cannot restore the stale status), and the unit is dispatched. The killed attempt does not count: the attempt loop numbers a fresh dispatch from 1. `--dry-run` writes nothing and still reports the unit, with wording that now says a real run will reset it. `blocked_human` is untouched. Tests: - tests/test_interrupted_unit_reset.py: a real `loop.run()` on a temp repo resets and dispatches the interrupted unit and the one behind it (attempts recorded as 1, reset committed); dry-run writes nothing; a blocked_human unit is left for the operator (control). Verification: - scripts/smoke-test.sh: 5104 tests OK (4 skipped), lint/security/coverage green. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3602.
Root cause
A unit is
in_progressonly while a driver is running it. A driver killed mid-attempt never moves it to an outcome, so the nextspecfuse runfound it neither dispatchable nor finished and halted the gate with "never became ready", telling the operator to reset the frontmatter by hand.Fix
run()already holds the working tree's.specfuse/.loop.lockbefore it loads the gate's units, so no other driver in this tree can be running such a unit. On a real run, the newreset_interrupted_unitsreturns eachin_progressunit topendingwithattempts: 0, the reset is committed as bookkeeping (so a later failed attempt'sgit reset --hardcannot restore the stale status), and the unit is dispatched. The killed attempt does not count against the unit: a fresh dispatch is numbered from 1.--dry-runwrites nothing; its halt text now says a real run resets the unit.blocked_humanis untouched.No new event type: the reset is recorded by its bookkeeping commit and a console line.
Tests
tests/test_interrupted_unit_reset.pydrives a realloop.run()on a temp git repo with the agent session stubbed:donewithattempts: 1; the unit behind it runs too; the reset is committed;--dry-runleaves the file unchanged and dispatches nothing;blocked_humanunit is not reset.The first test fails on
mainwith the exact halt from the report.Verification
scripts/smoke-test.sh: 5104 tests OK (4 skipped); lint, security and coverage green.🤖 Generated with Claude Code